package com.bhs.sansonglogistics.ui.adapter;

import android.view.View;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bhs.sansonglogistics.R;
import com.bhs.sansonglogistics.bean.PictureShowBean;
import com.bhs.sansonglogistics.utils.MyUtils;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class PictureShowAdapter extends BaseQuickAdapter<PictureShowBean, BaseViewHolder> {


    public PictureShowAdapter(@Nullable List<PictureShowBean> data) {
        super(R.layout.item_picture2, data);
    }

    public PictureShowAdapter(int layoutResId) {
        super(layoutResId);
    }

    public PictureShowAdapter() {
        super(R.layout.item_picture2);
    }


    @Override
    protected void convert(@NonNull BaseViewHolder helper, PictureShowBean item) {
        ImageView ivVideo = helper.getView(R.id.iv_video);
        if (ivVideo != null) {
            ivVideo.setVisibility(item.getImage().endsWith(".mp4") ? View.VISIBLE : View.GONE);
        }
        Glide.with(mContext).load(MyUtils.watermark(item.getImage())).into((ImageView) helper.getView(R.id.iv_picture));
    }
}
